#ifndef __UTIL_CU__
#define __UTIL_CU__
#include "util.h"
static void gpu_malloc(uint32** dest, uint32 size)
{
	cutilSafeCall(cudaMalloc((void**)dest, size));
	cutilSafeCall(cudaMemset((*dest), 0, size));
}
static void gpu_malloc(uint8** dest, uint32 size)
{
	cutilSafeCall(cudaMalloc((void**)dest, size));
	cutilSafeCall(cudaMemset((*dest), 0, size));
}
static void TOGPU(uint32*dest, uint32* src, uint32 size)
{
	cutilSafeCall(cudaMemcpy(dest, src, size, cudaMemcpyHostToDevice));
}
static void TOGPU(uint8*dest, uint8* src, uint32 size)
{
	cutilSafeCall(cudaMemcpy(dest, src, size, cudaMemcpyHostToDevice));
}
static void FROMGPU(uint32*dest, uint32* src, uint32 size)
{
	cutilSafeCall(cudaMemcpy(dest, src, size, cudaMemcpyDeviceToHost));
}
static void FROMGPU(uint8*dest, uint8* src, uint32 size)
{
	cutilSafeCall(cudaMemcpy(dest, src, size, cudaMemcpyDeviceToHost));
}

static void FREEGPU(uint32** data)
{
	cutilSafeCall(cudaFree(*data));
	(*data) = NULL;
}
static void FREEGPU(uint8** data)
{
	cutilSafeCall(cudaFree(*data));
	(*data) = NULL;
}


#endif

